<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Object.getPrototypeOf()</title>
  </head>
  <body>
    <p>Object.getPrototypeOf(obj) 获取对象的原型</p>
    <pre>
          function Rectangle(){
          }
          let rec=new Rectangle();  
          console.log(Object.getPrototypeOf(rec) == Rectangle.prototype); // true
      </pre
    >
    <p>如果obj不是对象，自动转换为对象</p>
    <pre>
             Object.getPrototypeOf(1)  //等同于
             Object.getPrototypeOf(Number(1))
           </pre
    >
  </body>
</html>
<script>
  function Rectangle() {
    console.log("rectangle");
  }
  let rec = new Rectangle();
  console.log(Object.getPrototypeOf(rec) == Rectangle.prototype); // true
</script>
